<template>
	<el-container>
		<el-aside>
		</el-aside>
		<el-container>
			<el-main class="nopadding">
				<el-card header="当前机构信息接收设置">
					<el-form-item label="信息接收人">
						<select-user-dialog v-model:accountId="form.optAccountId" :mode="false"/>
					</el-form-item>
					<div style="text-align: center">
						<el-button type="primary" :loading="isSaveing" @click="submit()">保 存</el-button>
					</div>
				</el-card>
			</el-main>

		</el-container>
		<el-aside>
		</el-aside>
	</el-container>
</template>

<script>
import selectUserDialog from "@/views/module/selectUserDialog";
export default {
	name: 'System Forward',
	components: {
		selectUserDialog
	},
	data() {
		return {
			isSaveing: false,
			form:{
				optAccountId:''
			}
		}
	},
	mounted() {
		this.getEmailForwardConfig();
	},
	methods:{
		async getEmailForwardConfig() {
			var res = await this.$API.email.getEmailForwardConfig.get();
			if (res.code == 200) {
				this.form.optAccountId = res.data.optAccountId;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		async submit(){
			this.isSaveing = true;
			var res = await this.$API.email.setEmailForwardConfig.post(this.form);
			this.isSaveing = false;
			if (res.code == 200) {
				this.visible = false;
				this.$message.success("操作成功")
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		}
	}
}
</script>

<style>
</style>
